package seunit.framework;

import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import java.util.LinkedHashMap;
import java.util.LinkedList;

/**
 * @class TestSuite
 * TestSuite.java
 * Purpose: TestSuite runner for FrameWork
 *
 * @author Vishal Sangave
 * @version 1.0 5 June 2012
 */
public class TestSuite {

	/**
	 * readList
	 * 
     * The readList method gets the execution List from Excel File.
     * 
     * @author Vishal Sangave
     * @param Class<?>
     * @return Iterable<Method>
     */
	public static Iterable<Method> getAllDeclaredMethods(Class<?> clases) throws InvocationTargetException,Exception{
	    LinkedHashMap<String, Method> all = new LinkedHashMap<String, Method>();
	    while (clases != null && clases != Object.class) {
	        Method[] methods = clases.getDeclaredMethods();
	        for (Method method : methods) {
	            String signature = method.getName();
	            if (!all.containsKey(signature))
	                all.put(signature, method);
	        }
	        clases = clases.getSuperclass();
	    }
	    return new LinkedList<Method>(all.values());
	}
}